// package: rewords-server-2024
// filename: dict
// author: diogoxiang@gmail.com
// time: 2024/11/8 10:23

package admin

import (
	"rewords-server-2024/internal/model/entity"
	"rewords-server-2024/internal/model/input/query_in"

	"github.com/gogf/gf/v2/frame/g"
)

type DictListReq struct {
	g.Meta         `path:"/sys/dict/query" method:"post" summary:"获取字典列表" tags:"字典"`
	Conditions     []query_in.Condition  `json:"conditions,omitempty" summary:"查找条件"`   // 查找字段
	OrderFields    []query_in.OrderField `json:"order_fields,omitempty" summary:"排序字段"` // 排序字段
	*query_in.Page `json:"page"`         // 分页
}

type DictListRes struct {
	Data []entity.SysDict `json:"list"`
	query_in.PageResult
}

type DictAddReq struct {
	g.Meta `path:"/sys/dict/add" method:"post" summary:"添加字典" tags:"字典"`
	entity.SysDict
	//entity.SysDictGroup
}

type DictAddRes struct {
	Id int64 `json:"id" summary:"字典ID"`
}

type DictInfoReq struct {
	g.Meta `path:"/sys/dict/query_id" method:"get" summary:"获取字典信息" tags:"字典"`
	Id     int64 `json:"id" v:"required#字典ID不能为空" dc:"字典ID"`
}

type DictInfoRes struct {
	entity.SysDict
}

type DictUpdateReq struct {
	g.Meta `path:"/sys/dict/update" method:"put" summary:"更新字典" tags:"字典"`
	entity.SysDict
}

type DictUpdateRes struct{}

type DictDeleteReq struct {
	g.Meta `path:"/sys/dict/del" method:"get" summary:"删除字典" tags:"字典"`
	Id     int64 `json:"ids" v:"required#字典ID不能为空" dc:"字典ID"`
}
type DictDeleteRes struct{}

type DictBatchUpdateReq struct {
	g.Meta `path:"/sys/dict/batch-update" method:"patch" summary:"批量更新字典" tags:"字典"`
	Rows   []map[string]any `json:"rows"`
}

type DictBatchUpdateRes struct {
	Rows []int64 `json:"rows"`
}
